package com.gwtgeo.ui.client.mvp.layers;

import com.gwtgeo.service.model.WMSLayerDef;
import com.gwtgeo.ui.client.mvp.adapter.RecordMapper;
import com.smartgwt.client.data.Record;

public class WMSLayerDefRecordMapper implements RecordMapper<WMSLayerDef> {

	public static final String ID = "id"; 
	public static final String NAME = "name";
	public static final String URL = "url";
	public static final String IS_BASE_LAYER = "isBaseLayer";
	public static final String IS_VISIBLE = "isVisble";
	public static final String FORMAT = "format";
	public static final String LAYERS = "layers";
	public static final String IS_TRANSPARENT = "isTransparent";

	@Override
	public void mapAttributes(Record record, WMSLayerDef def) {
		record.setAttribute(ID, def.getId());
		record.setAttribute(NAME, def.getName());
		record.setAttribute(URL, def.getUrl());
		record.setAttribute(IS_BASE_LAYER, def.getIsBaseLayer());
		record.setAttribute(IS_VISIBLE, def.getIsVisble());
		record.setAttribute(FORMAT, def.getFormat());
		record.setAttribute(LAYERS, def.getLayers());
		record.setAttribute(IS_TRANSPARENT, def.getIsTransparent());
	}

}
